//
//  SCNMoneyGuideViewModel.swift
//  ShoucainuSwift
//
//  Created by 王家旭 on 2017/11/20.
//  Copyright © 2017年 Riluee. All rights reserved.
//

import UIKit
import ObjectMapper

class SCNMoneyGuideViewModel: NSObject {

    func requestMoneyGuideManageMoneyIndex(_ param: [String : String], successBlock:@escaping ((_ dataresult: Dictionary<String, SCNMoneyGuideDataresultModels>) -> Void)) -> Void {
        
        SCNRequestManager.postRequest(param, URL: SCNRequestAPI.other().manageMoney_index) { (response) in
            
            let moneyGuideModels = Mapper<SCNMoneyGuideModels>().map(JSONObject: response.result.value)
            
            if let tmp = moneyGuideModels?.dataresult {
                successBlock(tmp)
            }
        }
        
    }
    
}

class SCNMoneyGuideModels: Mappable {
    
    
    var dataresult: Dictionary<String, SCNMoneyGuideDataresultModels>?
    var errmsg: String?
    var status: Int?
    var servertime: Int?
    
    init(){}
    
    required init?(map: Map) {
        mapping(map:map)
    }
    
    func mapping(map: Map) {
        
        dataresult <- map["dataresult"]
        errmsg <- map["errmsg"]
        status <- map["status"]
        servertime <- map["servertime"]
    }
    
}

class SCNMoneyGuideDataresultModels: Mappable {
    
    
    var img: String?
    var text: String?
    var param: Dictionary<String, String>?
    var url: String?
    
    
    required init?(map: Map) {
        
        mapping(map: map)
    }
    
    func mapping(map: Map) {
        img <- map["img"]
        text <- map["text"]
        param <- map["param"]
        url <- map["url"]
    }
    
    
    
}
